<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <style>
        .avatar-uploader .el-upload {
            border: 1px dashed #d9d9d9;
            border-radius: 6px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

        .avatar-uploader .el-upload:hover {
            border-color: #409EFF;
        }

        .avatar-uploader-icon {
            font-size: 28px;
            color: #8c939d;
            width: 178px;
            height: 178px;
            line-height: 178px;
            text-align: center;
        }

        .avatar {
            width: 178px;
            height: 178px;
            display: block;
        }

        .datatable {
            position: relative;
            box-sizing: border-box;
            -webkit-box-flex: 1;
            width: 100%;
            max-width: 100%;
            font-size: 14px;
            color: rgb(96, 98, 102);
            overflow: hidden;
            flex: 1 1 0%;
        }

        .datatable td, .datatable th {
            padding: 12px 0;
            min-width: 0;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            text-overflow: ellipsis;
            vertical-align: middle;
            position: relative;
            text-align: left;
        }
        .switchStyle .el-switch__label {
            position: absolute;
            display: none;
            color: #fff;
        }
        .switchStyle .el-switch__label--left {
            z-index: 9;
            left: 6px;
        }
        .switchStyle .el-switch__label--right {
            z-index: 9;
            left: -14px;
        }
        .switchStyle .el-switch__label.is-active {
            display: block;
        }
        .switchStyle.el-switch .el-switch__core,
        .el-switch .el-switch__label {
            width: 50px !important;
        }
    </style>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>系统设置<small>用户管理</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>系统设置</el-breadcrumb-item>
            <el-breadcrumb-item>用户管理</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="app-container">
        <div class="box">
            <div class="filter-container">
                <el-input placeholder="用户名" v-model="pagination.queryString" style="width: 200px;" class="filter-item" @keyup.enter.native="handleCurrentChange(1)"></el-input>
                <el-button @click="pagination.currentPage=1; findPage()" class="dalfBut" >查询</el-button>
                <el-button type="primary" class="butT" @click="handleCreate()">新建</el-button>
            </div>
            <el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row>
                <el-table-column type="index" align="center" label="序号"></el-table-column>
                <el-table-column prop="birthday" label="出生日期" :formatter="dateFormat"  align="center" ></el-table-column>


                <el-table-column prop="username" label="用户名" align="center"></el-table-column>
                <el-table-column prop="telephone" label="手机号" align="center"></el-table-column>

                <el-table-column label="适用性别" align="center">
                    <template slot-scope="scope">
                        <span>{{ scope.row.gender == '0' ? '女':'男'}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="是否启用" align="center">
                    <template slot-scope="scope">
                        <el-switch
                                class="switchStyle"
                                v-model="scope.row.station=='0' ? false : true"
                                active-color="#13ce66"
                                active-text="启用"
                                inactive-color="#ff4949"
                                inactive-text="禁用"
                                @change="changeSwitch(scope.row)">
                        </el-switch>
                    </template>
                </el-table-column>

                <el-table-column prop="remark" label="说明" align="center"></el-table-column>
                <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
                        <el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-container">
                <el-pagination
                        class="pagiantion"
                        @current-change="handleCurrentChange"
                        :current-page="pagination.currentPage"
                        :page-size="pagination.pageSize"
                        layout="total, prev, pager, next, jumper"
                        :total="pagination.total">
                </el-pagination>
            </div>
            <!-- 新增标签弹层 -->
            <div class="add-form">
                <el-dialog title="新增用户" :visible.sync="dialogFormVisible">
                    <template>
                        <el-tabs v-model="activeName" type="card">
                            <!---->
                            <el-tab-pane label="基本信息" name="first">
                                <el-form label-position="right" label-width="100px" ref="dataAddForm" :model="formData" :rules="rules">
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="用户名" prop="username">
                                                <el-input v-model="formData.username"/>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="密码" prop="password">
                                                <el-input v-model="formData.password"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="24">
                                            <el-form-item label="上传图片">
                                                <el-upload
                                                        class="avatar-uploader"
                                                        action="/setmeal/upload.do"
                                                        :auto-upload="autoUpload"
                                                        name="imgFile"
                                                        :show-file-list="false"
                                                        :on-success="handleAvatarSuccess"
                                                        :before-upload="beforeAvatarUpload">
                                                    <img v-if="imageUrl" :src="imageUrl" class="avatar">
                                                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                                                </el-upload>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="适用性别">
                                                <el-select v-model="formData.gender">
                                                    <el-option label="女" value="0"></el-option>
                                                    <el-option label="男" value="1"></el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="状态">
                                                <el-select v-model="formData.station"   >
                                                    <el-option label="启用" value="1"></el-option>
                                                    <el-option label="禁用" value="0"></el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="手机号" prop="telephone">
                                                <el-input v-model="formData.telephone" ></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="出生日期">
                                                <!--<el-input v-model="formData.birthday" type="textarea"></el-input>-->
                                                <el-date-picker
                                                        v-model="formData.birthday"
                                                        type="date"
                                                        placeholder="选择日期">
                                                </el-date-picker>
                                            </el-form-item>

                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="24">
                                            <el-form-item label="说明" prop="remark">
                                                <el-input v-model="formData.remark"   type="textarea"></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>

                                </el-form>
                            </el-tab-pane>
                            <el-tab-pane label="角色信息" name="second">
                                <div class="checkScrol">
                                    <table class="datatable">
                                        <thead>
                                        <tr>
                                            <th>选择</th>
                                            <th>角色名称</th>
                                            <th>关键字</th>
                                            <th>角色说明</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr v-for="c in tableData">
                                            <td>
                                                <input :id="c.id" v-model="roleIds" type="checkbox" :value="c.id">
                                            </td>
                                            <!--
                                            ：value="c.id"获取检查项的id

                                            :for"c.id" 作用：和：id="c.id"绑定，这样点击label中的内容也能勾选复选框
                                              -->

                                            <td><label :for="c.id">{{c.name}}</label></td>
                                            <td><label :for="c.id">{{c.keyword}}</label></td>
                                            <td><label :for="c.id">{{c.description}}</label></td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </el-tab-pane>
                        </el-tabs>
                    </template>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="dialogFormVisible = false">取消</el-button>
                        <el-button type="primary" @click="handleAdd()">确定</el-button>
                    </div>
                </el-dialog>
            </div>

            <!-- 编辑标签弹层 -->
            <div class="add-form">
                <el-dialog title="编辑用户" :visible.sync="dialogFormVisible4Edit">
                    <template>
                        <el-tabs v-model="activeName" type="card">
                            <!---->
                            <el-tab-pane label="基本信息" name="first">
                                <el-form label-position="right" label-width="100px" ref="dataEditForm" :model="formData" :rules="rules">
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="用户名" prop="username">
                                                <el-input v-model="formData.username"/>
                                            </el-form-item>
                                        </el-col>
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="密码" prop="password">-->
<!--                                                <el-input v-model="formData.password"/>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
                                    </el-row>
                                    <el-row>
                                        <el-col :span="24">
                                            <el-form-item label="上传图片">
                                                <el-upload
                                                        class="avatar-uploader"
                                                        action="/setmeal/upload.do"
                                                        :auto-upload="autoUpload"
                                                        name="imgFile"
                                                        :show-file-list="false"
                                                        :on-success="handleAvatarSuccess"
                                                        :before-upload="beforeAvatarUpload">
                                                    <img v-if="imageUrl" :src="imageUrl" class="avatar">
                                                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                                                </el-upload>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="适用性别">
                                                <el-select v-model="formData.gender">
                                                    <el-option label="女" value="0"></el-option>
                                                    <el-option label="男" value="1"></el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="状态">
                                                <el-select v-model="formData.station"   >
                                                    <el-option label="启用" value="1"></el-option>
                                                    <el-option label="禁用" value="0"></el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>

                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="手机号" prop="telephone">
                                                <el-input v-model="formData.telephone" ></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="出生日期">
                                                <!--<el-input v-model="formData.birthday" type="textarea"></el-input>-->
                                                <el-date-picker
                                                        v-model="formData.birthday"
                                                        type="date"
                                                        placeholder="选择日期">
                                                </el-date-picker>
                                            </el-form-item>

                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="24">
                                            <el-form-item label="说明" prop="remark">
                                                <el-input v-model="formData.remark"   type="textarea"></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>

                                </el-form>
                            </el-tab-pane>
                            <el-tab-pane label="角色信息" name="second">
                                <div class="checkScrol">
                                    <table class="datatable">
                                        <thead>
                                        <tr>
                                            <th>选择</th>
                                            <th>角色名称</th>
                                            <th>关键字</th>
                                            <th>角色说明</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr v-for="c in tableData">
                                            <td>
                                                <input :id="c.id" v-model="roleIds" type="checkbox" :value="c.id">
                                            </td>
                                            <!--
                                            ：value="c.id"获取检查项的id

                                            :for"c.id" 作用：和：id="c.id"绑定，这样点击label中的内容也能勾选复选框
                                              -->

                                            <td><label :for="c.id">{{c.name}}</label></td>
                                            <td><label :for="c.id">{{c.keyword}}</label></td>
                                            <td><label :for="c.id">{{c.description}}</label></td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </el-tab-pane>
                        </el-tabs>
                    </template>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="dialogFormVisible4Edit = false">取消</el-button>
                        <el-button type="primary" @click="handleEdit()">确定</el-button>
                    </div>
                </el-dialog>
            </div>
        </div>
    </div>
</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
    var vue = new Vue({
        el: '#app',
        data:{
            pagination: {//分页相关模型数据
                currentPage: 1,//当前页码
                pageSize:10,//每页显示的记录数
                total:0,//总记录数
                queryString:null//查询条件
            },
            imageUrl:null,
            dataList: [
            ],//当前页要展示的分页列表数据
            formData: {},//表单数据
            imgFile:'',
            tableData:[],
            roleIds:[],
            dialogFormVisible: false,//增加表单是否可见
            dialogFormVisible4Edit:false,//编辑表单是否可见
            rules: {//校验规则
                password: [{ required: true, message: '密码为必填项', trigger: 'blur' }],
                username: [{ required: true, message: '用户名为必填项', trigger: 'blur' }],
                telephone: [{ required: true, message: '手机为必填项', trigger: 'blur' }],

            }
        },
        //钩子函数，VUE对象初始化完成后自动执行
        created() {
            this.findPage();//VUE对象初始化完成后调用分页查询方法，完成分页查询
        },
        methods: {
            //文件上传成功后的钩子，response为服务端返回的值，file为当前上传的文件封装成的js对象
            handleAvatarSuccess(response, file) { //http 200
                this.imageUrl = "http://qge28gq7m.hb-bkt.clouddn.com/" + response.data;
                this.$message({
                    type: response.flag ? 'success' : 'error',
                    message: response.message
                });
                //设置模型数据（图片名称），后续提交ajax请求时会提交到后台最终保存到数据库
                this.formData.img = response.data;
            },
            //上传图片之前执行
            beforeAvatarUpload(file) {
                const isJPG = file.type === 'image/jpeg';
                const isLt2M = file.size / 1024 / 1024 < 2;
                if (!isJPG) {
                    this.$message.error('上传套餐图片只能是 JPG 格式!');
                }
                if (!isLt2M) {
                    this.$message.error('上传套餐图片大小不能超过 2MB!');
                }
                return isJPG && isLt2M;
            },
            changeSwitch(row){
                row.station=='0' ? row.station='1' : row.station='0';
                //发送ajax请求,修改对应权限的状态信息
                axios.get("/user/updateStation.do?userId="+row.id+"&station="+row.station).then((res)=>{
                    if (response.data.flag){
                        //修改状态成功
                    }else {
                        this.$message.error(response.data.message);
                    }
                }).finally(()=>{
                    this.findPage();
                })
            },






            //编辑
            handleEdit() {
                this.$refs['dataEditForm'].validate(valid => {
                    if (valid) {

                        //var url="/checkgroup/update?checkitemIds="+this.checkitemIds;
                        // var url = "/user/update?roleIds= " + this.roleIds;
                        axios.post("/user/update.do?roleIds="+this.roleIds, this.formData).then(response => {
                            if (response.data.flag) {
                                //隐藏弹出框
                                this.dialogFormVisible4Edit = false;
                                this.$message.success(response.data.message);
                                return;
                            }
                            this.$message.error(response.data.message);
                        }).finally(() => {
                            this.findPage();
                        })

                    } else {
                        //表单校验不通过
                    }
                });

            },

            //时间格式化
            dateFormat:function(row,column){

                if (row.birthday!=null){

                    var t=new Date(row.birthday);//row 表示一行数据, updateTime 表示要格式化的字段名称

                    return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate();
                }

            },
            //添加
            handleAdd () {
                //添加表单校验，检查项不能为空
                this.$refs['dataAddForm'].validate(valid => {
                    if (valid) {
                        // var url = "/user/add?roleIds=" + this.roleIds;
                        axios.post("/user/add.do?roleIds="+ this.roleIds, this.formData).then(response => {

                            if (response.data.flag) {
                                //隐藏弹出框
                                this.dialogFormVisible = false;
                                this.$message.success(response.data.message);
                                return;
                            }
                            this.$message.error(response.data.message);
                        }).finally(() => {
                            //重新查询分页信息
                            this.findPage();
                        })


                    } else {
                        //表单校验不通过
                    }
                });



            },
            //分页查询
            findPage() {
                // var url="/user/findPage";

                axios.post("/user/findPage.do",this.pagination).then(resp=>{

                    if(resp.data.flag){

                        this.dataList= resp.data.data.rows;

                        this.pagination.total=resp.data.data.total;
                        return;

                    }

                    this.$message.error(resp.data.message);
                });



            },
            // 重置表单
            resetForm() {
                this.formData={};
                this.imageUrl=null;
            },
            // 弹出添加窗口
            handleCreate() {

                //重置表单数据
                this.resetForm();

                //默认切换到第一个标签页（基本信息）
                this.activeName = 'first';
                //展示新增弹出框
                this.dialogFormVisible = true;
                //重置用户勾选的检查项id数据
                this.roleIds = [];


                axios.get("/role/findAll.do").then(resp=>{
                    //查询检查项添加到
                    if (resp.data.flag){
                        this.tableData = resp.data.data;
                        return;
                    }else {
                        this.$message.error(resp.data.message)
                    }
                })
            },
            // 弹出编辑窗口
            handleUpdate(row) {
                this.resetForm();

                this.activeName = "first";
                //查询当前用户基本信息
                axios.get("/user/findByUserId.do?id=" + row.id).then(response => {
                    if (!response.data.flag) {
                        this.$message.error(response.data.message);
                        return;
                    }
                    this.formData = response.data.data;
                    this.imageUrl="http://qge28gq7m.hb-bkt.clouddn.com/"+response.data.data.img;

                    //查询所有检查项信息
                    axios.get("/role/findAll.do").then(response => {
                        if (!response.data.flag) {
                            this.$message.error(response.data.message);
                            return;
                        }
                        this.tableData = response.data.data;
                    });

                    //查询检查组关联的检查项信息
                    axios.get("/user/findRoleByUserId.do?id=" + row.id).then(response => {
                        if (!response.data.flag) {
                            this.$message.error(response.data.message);
                            return;
                        }
                        this.roleIds = response.data.data;
                    });
                });
                this.dialogFormVisible4Edit = true;
            },
            //切换页码
            handleCurrentChange(currentPage) {
                this.pagination.currentPage=currentPage;

                this.findPage();

            },
            // 删除
            handleDelete(row) {
                this.$confirm("您确定要删除此记录吗?", "提示", {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    //发送异步请求, 删除用户
                    axios.get("/user/delete.do?id=" + row.id).then(response => {
                        if (response.data.flag) {
                            this.$message.success(response.data.message);
                            return;
                        }
                        this.$message.error(response.data.message);
                    }).finally(() => {
                        this.findPage();
                    });
                });
            }
        }
    })
</script>
</html>



<!--<!DOCTYPE html>-->
<!--<html>-->
<!--<head>-->
<!--    &lt;!&ndash; 页面meta &ndash;&gt;-->
<!--    <meta charset="utf-8">-->
<!--    <meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<!--    <title>传智健康</title>-->
<!--    <meta name="description" content="传智健康">-->
<!--    <meta name="keywords" content="传智健康">-->
<!--    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">-->
<!--    &lt;!&ndash; 引入样式 &ndash;&gt;-->
<!--    <link rel="stylesheet" href="../plugins/elementui/index.css">-->
<!--    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">-->
<!--    <link rel="stylesheet" href="../css/style.css">-->
<!--    <style>-->
<!--        .switchStyle .el-switch__label {-->
<!--            position: absolute;-->
<!--            display: none;-->
<!--            color: #fff;-->
<!--        }-->
<!--        .switchStyle .el-switch__label&#45;&#45;left {-->
<!--            z-index: 9;-->
<!--            left: 6px;-->
<!--        }-->
<!--        .switchStyle .el-switch__label&#45;&#45;right {-->
<!--            z-index: 9;-->
<!--            left: -14px;-->
<!--        }-->
<!--        .switchStyle .el-switch__label.is-active {-->
<!--            display: block;-->
<!--        }-->
<!--        .switchStyle.el-switch .el-switch__core,-->
<!--        .el-switch .el-switch__label {-->
<!--            width: 50px !important;-->
<!--        }-->
<!--    </style>-->
<!--</head>-->
<!--<body class="hold-transition">-->
<!--<div id="app">-->
<!--    <div class="content-header">-->
<!--        <h1>系统设置<small>用户管理</small></h1>-->
<!--        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">-->
<!--            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>-->
<!--            <el-breadcrumb-item>系统设置</el-breadcrumb-item>-->
<!--            <el-breadcrumb-item>用户管理</el-breadcrumb-item>-->
<!--        </el-breadcrumb>-->
<!--    </div>-->
<!--    <div class="app-container">-->
<!--        <div class="box">-->
<!--            <div class="filter-container">-->
<!--                <el-input placeholder="用户名" v-model="pagination.queryString" style="width: 200px;" class="filter-item"></el-input>-->
<!--                <el-button @click="pagination.currentPage=1; findPage()" class="dalfBut">查询</el-button>-->
<!--                <el-button type="primary" class="butT" @click="handleCreate()">新建</el-button>-->
<!--            </div>-->
<!--            <el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row>-->
<!--                <el-table-column type="index" align="center" label="序号"></el-table-column>-->
<!--                <el-table-column prop="birthday" label="出生日期" :formatter="dateFormat"  align="center" ></el-table-column>-->


<!--                <el-table-column prop="username" label="用户名" align="center"></el-table-column>-->
<!--                <el-table-column prop="telephone" label="手机号" align="center"></el-table-column>-->

<!--                <el-table-column label="适用性别" align="center">-->
<!--                    <template slot-scope="scope">-->
<!--                        <span>{{ scope.row.gender == '0' ? '女':'男'}}</span>-->
<!--                    </template>-->
<!--                </el-table-column>-->
<!--                <el-table-column label="是否启用" align="center">-->
<!--                    <template slot-scope="scope">-->
<!--                        <el-switch-->
<!--                                class="switchStyle"-->
<!--                                v-model="scope.row.station=='0' ? false : true"-->
<!--                                active-color="#13ce66"-->
<!--                                active-text="启用"-->
<!--                                inactive-color="#ff4949"-->
<!--                                inactive-text="禁用"-->
<!--                                @change="changeSwitch(scope.row)">-->
<!--                        </el-switch>-->
<!--                    </template>-->
<!--                </el-table-column>-->

<!--                <el-table-column prop="remark" label="说明" align="center"></el-table-column>-->
<!--                <el-table-column label="操作" align="center">-->
<!--                    <template slot-scope="scope">-->
<!--                        <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>-->
<!--                        <el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>-->
<!--                    </template>-->
<!--                </el-table-column>-->
<!--            </el-table>-->
<!--            <div class="pagination-container">-->
<!--                <el-pagination-->
<!--                        class="pagiantion"-->
<!--                        @current-change="handleCurrentChange"-->
<!--                        :current-page="pagination.currentPage"-->
<!--                        :page-size="pagination.pageSize"-->
<!--                        layout="total, prev, pager, next, jumper"-->
<!--                        :total="pagination.total">-->
<!--                </el-pagination>-->
<!--            </div>-->
<!--            &lt;!&ndash; 新增标签弹层 &ndash;&gt;-->
<!--            <div class="add-form">-->
<!--                <el-dialog title="新增用户" :visible.sync="dialogFormVisible">-->
<!--                    <template>-->
<!--                        <el-tabs v-model="activeName" type="card">-->
<!--                            &lt;!&ndash;&ndash;&gt;-->
<!--                            <el-tab-pane label="基本信息" name="first">-->
<!--                                <el-form label-position="right" label-width="100px" ref="dataAddForm" :model="formData" :rules="rules">-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="用户名" prop="username">-->
<!--                                                <el-input v-model="formData.username"/>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="密码" prop="password">-->
<!--                                                <el-input v-model="formData.password"/>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                    </el-row>-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="适用性别">-->
<!--                                                <el-select v-model="formData.gender">-->
<!--                                                    <el-option label="女" value="0"></el-option>-->
<!--                                                    <el-option label="男" value="1"></el-option>-->
<!--                                                </el-select>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="状态">-->
<!--                                                <el-select v-model="formData.station"   >-->
<!--                                                    <el-option label="启用" value="1"></el-option>-->
<!--                                                    <el-option label="禁用" value="0"></el-option>-->
<!--                                                </el-select>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                    </el-row>-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="手机号" prop="telephone">-->
<!--                                                <el-input v-model="formData.telephone" ></el-input>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                    </el-row>-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="出生日期">-->
<!--                                                &lt;!&ndash;<el-input v-model="formData.birthday" type="textarea"></el-input>&ndash;&gt;-->
<!--                                                <el-date-picker-->
<!--                                                  v-model="formData.birthday"-->
<!--                                                  type="date"-->
<!--                                                  placeholder="选择日期">-->
<!--                                                </el-date-picker>-->
<!--                                            </el-form-item>-->

<!--                                        </el-col>-->
<!--                                    </el-row>-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="24">-->
<!--                                            <el-form-item label="说明" prop="remark">-->
<!--                                                <el-input v-model="formData.remark"   type="textarea"></el-input>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                    </el-row>-->

<!--                                </el-form>-->
<!--                            </el-tab-pane>-->
<!--                            <el-tab-pane label="角色信息" name="second">-->
<!--                                <div class="checkScrol">-->
<!--                                    <table class="datatable">-->
<!--                                        <thead>-->
<!--                                        <tr>-->
<!--                                            <th>选择</th>-->
<!--                                            <th>角色名称</th>-->
<!--                                            <th>关键字</th>-->
<!--                                            <th>角色说明</th>-->
<!--                                        </tr>-->
<!--                                        </thead>-->
<!--                                        <tbody>-->
<!--                                        <tr v-for="c in tableData">-->
<!--                                            <td>-->
<!--                                                <input :id="c.id" v-model="roleIds" type="checkbox" :value="c.id">-->
<!--                                            </td>-->
<!--                                            &lt;!&ndash;-->
<!--                                            ：value="c.id"获取检查项的id-->

<!--                                            :for"c.id" 作用：和：id="c.id"绑定，这样点击label中的内容也能勾选复选框-->
<!--                                              &ndash;&gt;-->

<!--                                            <td><label :for="c.id">{{c.name}}</label></td>-->
<!--                                            <td><label :for="c.id">{{c.keyword}}</label></td>-->
<!--                                            <td><label :for="c.id">{{c.description}}</label></td>-->
<!--                                        </tr>-->
<!--                                        </tbody>-->
<!--                                    </table>-->
<!--                                </div>-->
<!--                            </el-tab-pane>-->
<!--                        </el-tabs>-->
<!--                    </template>-->
<!--                    <div slot="footer" class="dialog-footer">-->
<!--                        <el-button @click="dialogFormVisible = false">取消</el-button>-->
<!--                        <el-button type="primary" @click="handleAdd()">确定</el-button>-->
<!--                    </div>-->
<!--                </el-dialog>-->
<!--            </div>-->

<!--            &lt;!&ndash; 编辑标签弹层 &ndash;&gt;-->
<!--            <div class="add-form">-->
<!--                <el-dialog title="编辑用户" :visible.sync="dialogFormVisible4Edit">-->
<!--                    <template>-->
<!--                        <el-tabs v-model="activeName" type="card">-->
<!--                            &lt;!&ndash;&ndash;&gt;-->
<!--                            <el-tab-pane label="基本信息" name="first">-->
<!--                                <el-form label-position="right" label-width="100px" ref="dataEditForm" :model="formData" :rules="rules">-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="用户名" prop="username">-->
<!--                                                <el-input v-model="formData.username"/>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="密码" prop="password">-->
<!--                                                <el-input v-model="formData.password"/>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                    </el-row>-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="适用性别">-->
<!--                                                <el-select v-model="formData.gender">-->
<!--                                                    <el-option label="女" value="0"></el-option>-->
<!--                                                    <el-option label="男" value="1"></el-option>-->
<!--                                                </el-select>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="状态">-->
<!--                                                <el-select v-model="formData.station"   >-->
<!--                                                    <el-option label="启用" value="1"></el-option>-->
<!--                                                    <el-option label="禁用" value="0"></el-option>-->
<!--                                                </el-select>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                    </el-row>-->

<!--                                    <el-row>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="手机号" prop="telephone">-->
<!--                                                <el-input v-model="formData.telephone" ></el-input>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                    </el-row>-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="12">-->
<!--                                            <el-form-item label="出生日期">-->
<!--                                                &lt;!&ndash;<el-input v-model="formData.birthday" type="textarea"></el-input>&ndash;&gt;-->
<!--                                                <el-date-picker-->
<!--                                                        v-model="formData.birthday"-->
<!--                                                        type="date"-->
<!--                                                        placeholder="选择日期">-->
<!--                                                </el-date-picker>-->
<!--                                            </el-form-item>-->

<!--                                        </el-col>-->
<!--                                    </el-row>-->
<!--                                    <el-row>-->
<!--                                        <el-col :span="24">-->
<!--                                            <el-form-item label="说明" prop="remark">-->
<!--                                                <el-input v-model="formData.remark"   type="textarea"></el-input>-->
<!--                                            </el-form-item>-->
<!--                                        </el-col>-->
<!--                                    </el-row>-->

<!--                                </el-form>-->
<!--                            </el-tab-pane>-->
<!--                            <el-tab-pane label="角色信息" name="second">-->
<!--                                <div class="checkScrol">-->
<!--                                    <table class="datatable">-->
<!--                                        <thead>-->
<!--                                        <tr>-->
<!--                                            <th>选择</th>-->
<!--                                            <th>角色名称</th>-->
<!--                                            <th>关键字</th>-->
<!--                                            <th>角色说明</th>-->
<!--                                        </tr>-->
<!--                                        </thead>-->
<!--                                        <tbody>-->
<!--                                        <tr v-for="c in tableData">-->
<!--                                            <td>-->
<!--                                                <input :id="c.id" v-model="roleIds" type="checkbox" :value="c.id">-->
<!--                                            </td>-->
<!--                                            &lt;!&ndash;-->
<!--                                            ：value="c.id"获取检查项的id-->

<!--                                            :for"c.id" 作用：和：id="c.id"绑定，这样点击label中的内容也能勾选复选框-->
<!--                                              &ndash;&gt;-->

<!--                                            <td><label :for="c.id">{{c.name}}</label></td>-->
<!--                                            <td><label :for="c.id">{{c.keyword}}</label></td>-->
<!--                                            <td><label :for="c.id">{{c.description}}</label></td>-->
<!--                                        </tr>-->
<!--                                        </tbody>-->
<!--                                    </table>-->
<!--                                </div>-->
<!--                            </el-tab-pane>-->
<!--                        </el-tabs>-->
<!--                    </template>-->
<!--                    <div slot="footer" class="dialog-footer">-->
<!--                        <el-button @click="dialogFormVisible4Edit = false">取消</el-button>-->
<!--                        <el-button type="primary" @click="handleEdit()">确定</el-button>-->
<!--                    </div>-->
<!--                </el-dialog>-->
<!--            </div>-->
<!--        </div>-->
<!--    </div>-->
<!--</div>-->
<!--</body>-->
<!--&lt;!&ndash; 引入组件库 &ndash;&gt;-->
<!--<script src="../js/vue.js"></script>-->
<!--<script src="../plugins/elementui/index.js"></script>-->
<!--<script type="text/javascript" src="../js/jquery.min.js"></script>-->
<!--<script src="../js/axios-0.18.0.js"></script>-->
<!--<script>-->
<!--    var vue = new Vue({-->
<!--        el: '#app',-->
<!--        data:{-->
<!--            pagination: {//分页相关模型数据-->
<!--                currentPage: 1,//当前页码-->
<!--                pageSize:10,//每页显示的记录数-->
<!--                total:0,//总记录数-->
<!--                queryString:null//查询条件-->
<!--            },-->
<!--            dataList: [-->
<!--            ],//当前页要展示的分页列表数据-->
<!--            formData: {},//表单数据-->
<!--            tableData:[],-->
<!--            roleIds:[],-->
<!--            dialogFormVisible: false,//增加表单是否可见-->
<!--            dialogFormVisible4Edit:false,//编辑表单是否可见-->
<!--            rules: {//校验规则-->
<!--                password: [{ required: true, message: '密码为必填项', trigger: 'blur' }],-->
<!--                username: [{ required: true, message: '用户名为必填项', trigger: 'blur' }]-->
<!--            }-->
<!--        },-->
<!--        //钩子函数，VUE对象初始化完成后自动执行-->
<!--        created() {-->
<!--            this.findPage();//VUE对象初始化完成后调用分页查询方法，完成分页查询-->
<!--        },-->
<!--        methods: {-->




<!--            changeSwitch(row){-->
<!--                row.station=='0' ? row.station='1' : row.station='0';-->
<!--                //发送ajax请求,修改对应权限的状态信息-->
<!--                axios.get("/user/updateStation.do?userId="+row.id+"&station="+row.station).then((res)=>{-->
<!--                    if (response.data.flag){-->
<!--                        //修改状态成功-->
<!--                    }else {-->
<!--                        this.$message.error(response.data.message);-->
<!--                    }-->
<!--                }).finally(()=>{-->
<!--                    this.findPage();-->
<!--                })-->
<!--            },-->






<!--            //编辑-->
<!--            handleEdit() {-->
<!--                this.$refs['dataEditForm'].validate(valid => {-->
<!--                    if (valid) {-->

<!--                        //var url="/checkgroup/update?checkitemIds="+this.checkitemIds;-->
<!--                        // var url = "/user/update?roleIds= " + this.roleIds;-->
<!--                        axios.post("/user/update.do?roleIds="+this.roleIds, this.formData).then(response => {-->
<!--                            if (response.data.flag) {-->
<!--                                //隐藏弹出框-->
<!--                                this.dialogFormVisible4Edit = false;-->
<!--                                this.$message.success(response.data.message);-->
<!--                                return;-->
<!--                            }-->
<!--                            this.$message.error(response.data.message);-->
<!--                        }).finally(() => {-->
<!--                            this.findPage();-->
<!--                        })-->

<!--                    } else {-->
<!--                        //表单校验不通过-->
<!--                    }-->
<!--                });-->

<!--            },-->

<!--            //时间格式化-->
<!--            dateFormat:function(row,column){-->

<!--                if (row.birthday!=null){-->

<!--                    var t=new Date(row.birthday);//row 表示一行数据, updateTime 表示要格式化的字段名称-->

<!--                    return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate();-->
<!--                }-->

<!--            },-->
<!--            //添加-->
<!--            handleAdd () {-->
<!--                //添加表单校验，检查项不能为空-->
<!--                this.$refs['dataAddForm'].validate(valid => {-->
<!--                    if (valid) {-->
<!--                        // var url = "/user/add?roleIds=" + this.roleIds;-->
<!--                        axios.post("/user/add.do?roleIds="+ this.roleIds, this.formData).then(response => {-->

<!--                            if (response.data.flag) {-->
<!--                                //隐藏弹出框-->
<!--                                this.dialogFormVisible = false;-->
<!--                                this.$message.success(response.data.message);-->
<!--                                return;-->
<!--                            }-->
<!--                            this.$message.error(response.data.message);-->
<!--                        }).finally(() => {-->
<!--                            //重新查询分页信息-->
<!--                            this.findPage();-->
<!--                        })-->


<!--                    } else {-->
<!--                        //表单校验不通过-->
<!--                    }-->
<!--                });-->



<!--            },-->
<!--            //分页查询-->
<!--            findPage() {-->
<!--                // var url="/user/findPage";-->

<!--                axios.post("/user/findPage.do",this.pagination).then(resp=>{-->

<!--                    if(resp.data.flag){-->

<!--                        this.dataList= resp.data.data.rows;-->

<!--                        this.pagination.total=resp.data.data.total;-->
<!--                        return;-->

<!--                    }-->

<!--                    this.$message.error(resp.data.message);-->
<!--                });-->



<!--            },-->
<!--            // 重置表单-->
<!--            resetForm() {-->
<!--                this.formData={};-->
<!--            },-->
<!--            // 弹出添加窗口-->
<!--            handleCreate() {-->

<!--                //重置表单数据-->
<!--                this.resetForm();-->


<!--                //默认切换到第一个标签页（基本信息）-->
<!--                this.activeName = 'first';-->
<!--                //展示新增弹出框-->
<!--                this.dialogFormVisible = true;-->
<!--                //重置用户勾选的检查项id数据-->
<!--                this.roleIds = [];-->


<!--                axios.get("/role/findAll.do").then(resp=>{-->
<!--                    //查询检查项添加到-->
<!--                    if (resp.data.flag){-->
<!--                        this.tableData = resp.data.data;-->
<!--                        this.$message.success(resp.data.message);-->

<!--                        return;-->
<!--                    }else {-->
<!--                        this.$message.error(resp.data.message)-->
<!--                    }-->
<!--                })-->
<!--            },-->
<!--            // 弹出编辑窗口-->
<!--            handleUpdate(row) {-->
<!--                this.resetForm();-->
<!--                this.activeName = "first";-->
<!--                //查询当前用户基本信息-->
<!--                axios.get("/user/findByUserId.do?id=" + row.id).then(response => {-->
<!--                    if (!response.data.flag) {-->
<!--                        this.$message.error(response.data.message);-->
<!--                        return;-->
<!--                    }-->
<!--                    this.formData = response.data.data;-->

<!--                    //查询所有检查项信息-->
<!--                    axios.get("/role/findAll.do").then(response => {-->
<!--                        if (!response.data.flag) {-->
<!--                            this.$message.error(response.data.message);-->
<!--                            return;-->
<!--                        }-->
<!--                        this.tableData = response.data.data;-->
<!--                    });-->

<!--                    //查询检查组关联的检查项信息-->
<!--                    axios.get("/user/findRoleByUserId.do?id=" + row.id).then(response => {-->
<!--                        if (!response.data.flag) {-->
<!--                            this.$message.error(response.data.message);-->
<!--                            return;-->
<!--                        }-->
<!--                        this.roleIds = response.data.data;-->
<!--                    });-->
<!--                });-->
<!--                this.dialogFormVisible4Edit = true;-->
<!--            },-->
<!--            //切换页码-->
<!--            handleCurrentChange(currentPage) {-->
<!--                this.pagination.currentPage=currentPage;-->

<!--                this.findPage();-->

<!--            },-->
<!--            // 删除-->
<!--            handleDelete(row) {-->
<!--                this.$confirm("您确定要删除此记录吗?", "提示", {-->
<!--                    confirmButtonText: '确定',-->
<!--                    cancelButtonText: '取消',-->
<!--                    type: 'warning'-->
<!--                }).then(() => {-->
<!--                    //发送异步请求, 删除用户-->
<!--                    axios.get("/user/delete.do?id=" + row.id).then(response => {-->
<!--                        if (response.data.flag) {-->
<!--                            this.$message.success(response.data.message);-->
<!--                            return;-->
<!--                        }-->
<!--                        this.$message.error(response.data.message);-->
<!--                    }).finally(() => {-->
<!--                        this.findPage();-->
<!--                    });-->
<!--                });-->
<!--            }-->
<!--        }-->
<!--    })-->
<!--</script>-->
<!--</html>-->